# -*- coding: utf-8 -*-
# @Time    : 2022/10/12 22:11
# @Author  : 修远
# @File    : RedisUtils.py
# @Comment : 
from app.app import redis_client as conn
from flask import current_app


# 获取redis值
def get_redis_data(key):
    data = conn.get(key)
    return str(data, encoding="utf-8")


# 存到Redis
def set_redis_data(key, value):
    data = value
    conn.set(
        name=key,
        value=data,
        ex=current_app.config['EXPIRES_TIME']  # 第三个参数表示Redis过期时间,不设置则默认不过期
    )
